/*83856*/
<template>
  <div>
    <h5>子组件</h5>
    <el-button @click="clickThis">child click</el-button>
  </div>
</template>

<script lang="ts" setup>
import {ref, reactive, onMounted, watch} from "vue"

const a = "555";

const fn = () => {
  console.log("执行了fn");
};

defineExpose({
  a,
  fn,
});

// 接收传入的参数
const props = defineProps<{
  nums: number,
}>()

onMounted(() => {
  console.log('接收传入的参数 nums', props.nums)
})

// 子组件向父组件事件传递
/*ts专有*/
const emit = defineEmits<{
  (e: 'tclick', num: number): void
}>()

const clickThis = () => {
  emit('tclick', 2)
}

</script>

<style scoped lang="scss">

</style>